<?php
namespace App\Http\Controllers\Exp;
use App\Http\Controllers\ApiBaseController;
use Illuminate\Http\Request;
use App\Models\ExpModels\ExpCheck;
use App\Models\PartnerModels\Partner;
class GetController extends ApiBaseController{
    /**
	*	爆款码管理模块---活动审核
	*/
	
	public function __construct(Request $request) {
		$this->params = $request->all();
	}

	//待审核
	public function index(Request $request){
        if(!$request->session()->has('user')){
            return redirect('admin/login');
        }
        return view('exp/index',['void_exp_data'=>true]);
    }
    //已审核
    public function info(Request $request){
        if(!$request->session()->has('user')){
            return redirect('admin/login');
        }
        return view('exp/info',['void_exp_info'=>true]);
    }

	//拉取待审核列表
	function checkData(){
		$ExpCheck=new ExpCheck();
		$result = $ExpCheck->checkData($this->params);
        echo json_encode($result);
	}
    //拉取会员拓客列表数据
    public function dataList(){
        $oPartner = new Partner();
        $result = $oPartner->getVipTuokeData($this->params);
        echo json_encode($result);
    }
	//拉取会员的拓客用户数据
    function userList(){
        $ExpCheck=new ExpCheck();
        $partner_id=isset($this->params['kid']) ? $this->params['kid'] : '';
         $title=isset($this->params['title']) ? $this->params['title'] : '';
        $nextPage=isset($this->params['page']) && intval($this->params['page']) ? intval($this->params['page']) : 1;
        echo $ExpCheck->userList($partner_id,$title,$nextPage);
    }
    //拉取会员的视频数据
    function videoList(){
        $ExpCheck=new ExpCheck();
        $partner_id=isset($this->params['kid']) ? $this->params['kid'] : '';
        $title=isset($this->params['title']) ? $this->params['title'] : '';
        $nextPage=isset($this->params['page']) && intval($this->params['page']) ? intval($this->params['page']) : 1;
        echo $ExpCheck->videoList($partner_id,$title,$nextPage);
    }
    //拉取会员的视频数据
    function cardList(){
        $ExpCheck=new ExpCheck();
        $partner_id=isset($this->params['kid']) ? $this->params['kid'] : '';
        $title=isset($this->params['title']) ? $this->params['title'] : '';
        $nextPage=isset($this->params['page']) && intval($this->params['page']) ? intval($this->params['page']) : 1;
        echo $ExpCheck->cardList($partner_id,$title,$nextPage);
    }
    //拉取会员的活动数据
    function actList(){
        $ExpCheck=new ExpCheck();
        $partner_id=isset($this->params['kid']) ? $this->params['kid'] : '';
        $title=isset($this->params['title']) ? $this->params['title'] : '';
        $nextPage=isset($this->params['page']) && intval($this->params['page']) ? intval($this->params['page']) : 1;
        echo $ExpCheck->actList($partner_id,$title,$nextPage);
    }



















	//审核操作
	function checkSave(){
		$ExpCheck=new ExpCheck();
		$kid=isset($this->params['kid']) ? $this->params['kid'] : 0;
		$status=isset($this->params['status']) ? $this->params['status'] : 0;
		$checkTest=isset($this->params['checkTest']) ? $this->params['checkTest'] : '';
		$re=$ExpCheck->checkSave($kid,$status,$checkTest);
		$re ? $this->returnJson(0,'操作成功') : $this->returnJson(1,'操作失败');
	}


    //待审核
    public function tuokeindex(Request $request){
        if(!$request->session()->has('user')){
            return redirect('admin/login');
        }
        return view('exp/tuoke',['exp_list_tuoke'=>true]);
    }
	
	
}